﻿Imports System.Data
Imports System.Data.OleDb
Imports DAO
Imports DTO

Public Class XL_Chung_dao

    Dim provider As New DataProvider

    '................
    'Tìm ngày khởi hành
    Public Function TimNgayKhoiHanh(ByVal maTuyen As Integer) As DataTable
        Dim sql As String = "SELECT NgayKhoiHanh FROM LICHTUYENKHONGLAP WHERE MaTuyen = " & maTuyen
        sql += " Group by NgayKhoiHanh"

        Return provider.ThucThiCauTruyVan(sql)
    End Function

    'Tìm giờ khởi hành
    Public Function TimThoiDiemKhoiHanh(ByVal maTuyen As Integer, ByVal ngayKhoiHanh As Date) As DataTable
        Dim sql As String = "SELECT ThoiDiemKhoiHanh FROM LICHTUYENKHONGLAP WHERE MaTuyen = ? and NgayKhoiHanh = ?"
        Dim dsParameter As New List(Of OleDbParameter)
        dsParameter.Add(New OleDbParameter("@MaTuyen", maTuyen))
        dsParameter.Add(New OleDbParameter("@NgayKhoiHanh", ngayKhoiHanh))

        Return provider.ThucThiCauTruyVan(sql, dsParameter)
    End Function
End Class
